﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartCity.ProcessEngine.Api.Write.Application.Command.Node;
using SmartCity.ProcessEngine.ErrorCode;

namespace SmartCity.ProcessEngine.Api.Write.Controllers
{
    /// <summary>
    /// 节点控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class NodeController : ControllerBase
    {
        private readonly IMediator mediator;

        public NodeController(IMediator mediator)
        {
            this.mediator = mediator;
        }



        /// <summary>
        /// 添加流程节点
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> CreateNode(CreateNodeCommand request) { 
            return mediator.Send(request);
        }
    }
}
